package com.example.lib_cson.mvvm.view;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.ViewModel;

import com.example.lib_cson.mvvm.vm.BaseViewModel;

public abstract class BaseActivity<VM extends BaseViewModel,DB extends ViewDataBinding> extends AppCompatActivity {
    protected VM mViewModel;
    protected DB mDataBinding;
    protected abstract int byId();
    protected abstract VM getViewModel();
    protected abstract void initView();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDataBinding= DataBindingUtil.setContentView(this,byId());
        mViewModel=getViewModel();
        initView();
    }
}
